# $Id$
# Maintainer: Ricky Wu <rickleaf.wu@gmail.com>

_realname=gdlmm2
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=2.30.0
pkgrel=2
pkgdesc="GNOME Docking Library (mingw-w64)"
arch=('any')
license=('LGPL 2')
url="https://www.gnome.org/"
depends=("${MINGW_PACKAGE_PREFIX}-gtk2"
         "${MINGW_PACKAGE_PREFIX}-libxml2")
makedepends=("intltool"
             "gtk-doc")
options=('strip' 'staticlibs')
source=(https://download.gnome.org/sources/${_realname:0:5}/${pkgver:0:4}/${_realname:0:5}-${pkgver}.tar.gz
        000-C11.patch
        )
sha256sums=('48138b59388fc64340a56f07cc90ea90dbd00bd5070b14897319d8c8e619befd'
            '1b0f5da73b092808c16987a198ad456044cbe24f929bae6add31adfa5a2bc4fa')

prepare() {
  cd "${srcdir}"/${_realname:0:5}-${pkgver}
  
  patch -b -V simple -p1 -i ${srcdir}/000-C11.patch
}

build() {
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  mkdir -p docs/reference/html
  #cp -rf ../${_realname:0:5}-${pkgver}/docs/reference/html/* docs/reference/html

  ../${_realname:0:5}-${pkgver}/configure \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --libexecdir=${MINGW_PREFIX}/lib \
    --enable-static \
    --enable-shared
  make
}

package() {
  cd "$srcdir/build-${MINGW_CHOST}"
  make DESTDIR=$pkgdir install

  install -Dm644 "${srcdir}/${_realname:0:5}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
